<template>
  <div>
    <!-- <div style="display: none;">{$random_content}</div> -->
    <div class="mainmodule">
      <div class="mianad" v-if="storeInfo.is_user_img">
        <a @click="openLink(storeInfo.user_img_link)">
          <img :src="storeInfo.user_img_ggt || storeInfo.ad_img" alt />
        </a>
      </div>
      <div class="mainlist">
        <ul>
          <!-- 我的佣金 -->
          <li v-if="storeInfo.show_md_commission">
            <div @click="Jump('myCommission','fxs')" class="icon_wdyj">
              {{storeInfo.ftitle_commission}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 上月佣金排名 -->
          <li v-if="storeInfo.display_agent_sort && storeInfo.show_md_lastCommission">
            <div @click="Jump('commissionSort')" class="icon_syyjph">
              {{storeInfo.ftitle_ranking}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 我的上级 -->
          <li v-if="storeInfo.show_md_superior && storeInfo.superior_user_id">
            <div @click="Jump('fxsDirector')" class="icon_wdsj">
              {{storeInfo.ftitle_superior}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 微信扫码 -->
           <li v-if="storeInfo.show_md_code && storeInfo.is_wx==1">
            <div @click="_wxScanner()" class="icon_ewm">
              扫码核销
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 我的员工 -->
          <li v-if="storeInfo.show_md_staff">
            <div @click="Jump('staff-list')" class="icon_wdmember">
              我的员工
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 店中店 -->
          <li v-if="!storeInfo.is_app_open && storeInfo.is_store_log == 1 && storeInfo.show_md_myStore">
            <div @click="Jump('store')" class="icon_dzd">
              {{storeInfo.ftitle_store}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 门店订单 -->
          <li v-if="storeInfo.show_md_order">
            <div @click="Jump('storeOrderList')" class="icon_mddd">
              门店订单
              <span class="order-num" v-if="storeInfo.total_store_order_count">{{storeInfo.total_store_order_count}}</span>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 服务订单 -->
          <li v-if="storeInfo.is_store_serve_order">
            <div @click="Jump('serve-order')" class="icon_myserveorder">
              {{storeInfo.ftitle_store_serve_order}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 优惠券核销 -->
          <li v-if="storeInfo.show_coupon_verify">
            <div @click="Jump('writeOffCoupons')" class="icon_writeOffCoupons">
              优惠券核销
              <i class="icon_right"></i>
            </div>
          </li>
          <!-- 优惠券核销 -->
          <li v-if="storeInfo.show_store_inventory">
            <div @click="Jump('storeInventory')" class="icon_storeInventory">
              门店库存
              <i class="icon_right"></i>
            </div>
          </li>
          <!-- 供货订单 -->
          <li v-if="storeInfo.is_smart_store == 1">
            <div @click="Jump('listsGys')" class="icon_gysdd">
              供货订单
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 供货商品 -->
          <li v-if="storeInfo.is_smart_store == 1">
            <div @click="Jump('supplierItems')" class="icon_gyssp">
              供货商品
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 供货收入 -->
          <li v-if="storeInfo.is_smart_store == 1">
            <div @click="Jump('supplierWithdraw')" class="icon_gystx">
              供货收入
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
          <li v-if="storeInfo.common_center_renovation_parameter.showShareLinkStore">
            <div @click="Jump('/shareSelect')" class="icon20_1_fx">
              万能链接
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
           <!-- 视频号数据 -->
          <li v-if="storeInfo.show_video_num_data_store">
            <div @click="Jump('venderOrder', 'live')"
                 class="icon_sphsj">视频号数据
              <span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
        </ul>

        <!-- 自定义项 -->
        <ul v-if="storeInfo.dataset_store && storeInfo.dataset_store.length>0">
          <li v-for="(item,index) in storeInfo.dataset_store"
              :key="index">
            <a :href="item.link"
              class="custom_item"
              :style="{backgroundImage: 'url('+item.pic+')'}">
              {{item.showtitle}}
              <i class="icon_right"></i>
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { openPage } from '@/utils/utils.js'
export default Vue.extend({
  props: {
    storeInfo: {
      type: Object
    }
  },
  methods: {
    // TODO 小程序跳转
    openLink(link) {
      openPage(link)
    },
    linkTo(url) {
      window.location.href = url
    },
    Jump(url, type) {
      const data = { type }
      this.$JumpPath(this, url, data)
    },
    _wxScanner() {
      // TODO 小程序扫码
        wx.scanCode({
          success: (res) => {
            // console.log(res)
            openPage(res.result)
          }
        })
    },
    _show_qrcode() {
      this.$emit('showQrcode')
    }
  }
})
</script>

<style lang="scss">
@import 'src/styles/user/index.scss';
</style>
